export function getPosition(el) {
  let cursorPos = 0;
  if (document.selection) {
      var selectRange = document.selection.createRange();
      selectRange.moveStart('character', -el.value.length);
      cursorPos = selectRange.text.length;
  } else if (el.selectionStart || el.selectionStart === '0') {
      cursorPos = el.selectionStart;
  }
  return cursorPos;
}

export function getLineNumber (str) {
  let lineNum = str.split('\n').length
  return lineNum
}